<template>
  <t-adaptive-page2
      title="角色管理列表"
      :btnPermissions="btnPermissions"
      :columns="table2.columns"
      :table2="table2"
  >
  </t-adaptive-page2>
</template>

<script setup lang="tsx" name="menuMange">
import TIcon from "./TIcon.vue";
import useApi from "@/hooks/useApi";
import { useAuthStore } from "@/store/modules/auth";
const authStore = useAuthStore();
const btnPermissions = authStore.authButtonListGet;
const { proxy } = useApi();

const table2: any = reactive({
  toolbar:[
    {
      text: "添加",
      // hasPermi: "root:web:sys:role:alter",
      click: "add:///t-ui-plus/menu-mange/edit"
      // fun: edit
    },
    {
      text: "删除",
      // hasPermi: "root:web:sys:role:del",
      // fun: handleDelete
    }
  ],
  queryData: {
    title: null, // 菜单名称
    path: null // 菜单路径
  },
  url: "/sys/roleList",
  firstColumn: { type: "selection" },
  columns: [
    {
      prop: "title",
      label: "菜单名称",
      render: (text: any, row: any) => {
        return <div>{row.meta.title}</div>;
      },
      minWidth: 180,search: 'text'
    },
    {
      label: "菜单图标",
      render: (text: any, row: any) => {
        return <TIcon icon={row.meta.icon}></TIcon>;
      },
      minWidth: 80
    },
    {
      prop: "menuType",
      label: "菜单类型",
      minWidth: 120,
      render: (text: string) => {
        const typeMap: TypeMap = {
          M: { type: "info", val: "目录" },
          C: { type: "success", val: "菜单" },
          F: { type: "warning", val: "按钮" }
        };
        const { type, val } = typeMap[text] || {};
        return <el-tag type={type}>{val}</el-tag>;
      }
    },
    { prop: "name", label: "菜单 name", minWidth: 180 },
    { prop: "path", label: "菜单路径", minWidth: 180 },
    { prop: "component", label: "组件路径", minWidth: 180 }
  ],
  operator: [
    {
      text: "新增",
      // fun: handleAdd,
      hasPermi: "root:web:sys:menu:add"
    },
    {
      text: "编辑",
      // fun: edit,
      hasPermi: "root:web:sys:menu:alter"
    },
    {
      text: "删除",
      // fun: handleDelete,
      hasPermi: "root:web:sys:menu:del"
    }
  ],
});

</script>
